/* Check galois_wXX_region_multiply. */
#include <stdio.h>
#include "jerasure.h"
#include "reed_sol.h"

int main( int argc, char** argv )
{
	int *old_bitmatrix;
	int *inverse_matrix;
	int m = atoi( argv[1] );
	int k = atoi( argv[2] );
	int w = atoi( argv[3] );
	int i;
	
	unsigned char *buf1, *buf2;

	buf1 = (unsigned char*) malloc( sizeof(char) * 10 );
	buf2 = (unsigned char*) malloc( sizeof(char) * 10 );

	srand48(w);
	for( i = 0; i < 10; i++ )
	{
		buf1[i] = lrand48() % 256;
		fprintf( stdout, " %d", buf1[i] );
	}
	fprintf( stdout, "\n" );

	galois_w08_region_multiply( buf1, k, 10, NULL, 0 );
	fprintf( stdout, "Multiply in w = 8\n" );
	for( i = 0; i < 10; i++ )
		fprintf( stdout, " %d", buf1[i] );
	fprintf( stdout, "\n" );

	galois_w16_region_multiply( buf1, k, 10, NULL, 0 );
	fprintf( stdout, "Multiply in w = 16\n" );
	for( i = 0; i < 10; i++ )
		fprintf( stdout, " %d", buf1[i] );
	fprintf( stdout, "\n" );

	galois_w32_region_multiply( buf1, k, 10, NULL, 0 );
	fprintf( stdout, "Multiply in w = 32\n" );
	for( i = 0; i < 10; i++ )
		fprintf( stdout, " %d", buf1[i] );
	fprintf( stdout, "\n" );
	return 0;
}
